Release 10.1A: OpenEdge Development:
.NET Open Clients


Defining the schema for a temp-table parameter

Defining the schema for a Progress 4GL temp-table (TABLE or TABLE-HANDLE) parameter is a multi-step process.

To define the schema for a temp-table parameter:

  1. If the parameter is for input or input-output, define an ADO.NET DataTable to hold the parameter value.
  2. Define a TempTableMetaData object to hold the parameter schema.
  3. Add field descriptions to the TempTableMetaData object.
  4. Add the TempTableMetaData object and the DataTable (if applicable) as a temp-table parameter to your ParamArray object using the appropriate set parameter method.
Defining a TempTableMetaData object

For each temp-table (DataTable), you must define a Progress.Open4GL.Proxy.TempTableMetaData object to hold the schema using the following constructor:

Syntax
public TempTableMetaData (string dataTableName, string strongTypeName,  
                          int numFields, bool bimageFlag, int numIndexes, 
                          string multiIxCols,  
                          string XMLNamespace, string XMLPrefix) 

dataTableName

Specifies a name for the specified DataTable. This name is typically identical to any 4GL temp-table to which this collection is mapped.

strongTypeName

Specifies the type name for a strongly-typed ADO.NET DataTable, or null.

numFields

Specifies the number of fields in the specified DataTable.

bimageFlag

Specifies true if the corresponding Progress 4GL temp-table is defined with the BEFORE-TABLE option, indicating that the temp-table (and hence the DataTable) can be modified. Otherwise, this value must be false and you cannot pass modified data between the Open Client and the AppServer.

numIndexes

Specifies the number of indexes on the table.

multiIxCols

Specifies null if there are no indexes or a formatted string that contains all the index info for this temp-table, as follows:

Syntax
"[primeUniqueFlag,primeFld1[,primeFldn]...:primeIdxName.] 
[uniqueIdxfld1[,uniqueIdxfldn]...:uniqueIdxName.]..." 

primeUniqueFlag

Specifies a primary index with a value of 1 if the index is unique and a value of 0 if the index is not unique.

primeFld1[,primeFldn]...

Specifies the names of one or more fields involved in the primary index.

primeIdxName

Specifies the primary index name.

uniqueIdxfld1[,uniqueIdxfldn]...

Specifies names of one or more fields involved in a unique secondary index.

uniqueIdxName

Specifies a unique secondary index name.

Thus, a table can have no indexes, a single primary index followed by zero or more secondary unique indexes, or it can have a single secondary unique index followed by zero or more additional secondary unique indexes. Some examples follow:

XMLNamespace

Specifies the namespace for XML serialization or null.

XMLPrefix

Specifies the prefix for XML serialization or null.

Adding field descriptions to the TempTableMetaData object

Add the meta data for each field of the temp-table by calling the SetFieldMetaData() method on the TempTableMetaData object for each column in the temp-table:

Syntax
public void SetFieldMetaData (int fieldNumber, string fieldName,  
                              int extentValue, int proType,  
                              int userOrder, int xmlMapping) 

fieldNumber

Specifies a 1-based position that corresponds to the position of a mapped field in a Progress 4GL temp-table.

fieldName

Specifies a name that is typically identical to a mapped field in the corresponding 4GL temp-table. The value cannot be null and must be unique among fields (column properties) in the specified ProDataObject type.

extentValue

Specifies if and how the field represents an array field in the corresponding temp-table. The value must be 0 or greater. If the value is greater than 1, this column property is many-valued (represents an array field) and the value is its extent. If the property represents a BLOB or CLOB field, the value must be 0 or 1.

proType

Specifies the value of a class constant defined in the Progress.Open4GL.Parameter class. The specified class constant indicates the Progress 4GL data type of the mapped temp-table field. For more information on these class constants, see the sections on specifying the Progress temp-table field data types for the ProDataTable class in Chapter 4, " Passing Parameters." To identify the Java data type that the column property assumes for the specified 4GL data type, see the information on data type mapping for temp-table fields in the same chapter.

userOrder

Specifies a 0-based user order position for the column property.

xmlMapping

Reserved for future use. Always specify 0.

Adding the TempTableMetaData with its DataTable as a temp-table parameter

Add the TempTableMetaData object together with ADO.NET DataTable it describes by passing them as parameters of the AddTable() or AddTableHandle() method that you use to add the temp-table parameter to the ParamArray object. For more information, see the "TABLE and TABLE-HANDLE" section.

Example 8–1 adds a temp-table parameter defined with no indexes:

Example 8–1: Sample OpenAPI fragment adding a temp-table parameter
// Create the ParamArray 
ParamArray parms = new ParamArray(1); 
//Create Data table 
DataTable table = new DataTable(); 
... 
// Set up meta data 
TempTableMetaData metaData1 = new TempTableMetaData 
                          ("OrderDetails", 
                           "OrderProxy.StrongTypesNS.OrderDetailsDataTable",  
                           6, false, 0, null, null,null); 
metaData1.SetFieldMetaData 
             (1, "OrderNum",     0, Parameter.PRO_INTEGER,  0, 0); 
metaData1.SetFieldMetaData 
             (2, "SalesRep",     0, Parameter.PRO_CHARACTER 1, 0); 
metaData1.SetFieldMetaData 
             (3, "OrderDate",    0, Parameter.PRO_DATE      2, 0); 
metaData1.SetFieldMetaData 
             (4, "ShipDate",     0, Parameter.PRO_DATE      3, 0); 
metaData1.SetFieldMetaData 
             (5, "TotalDollars", 0, Parameter.PRO_DECIMAL   4, 0); 
metaData1.SetFieldMetaData 
             (6, "OrderStatus",  0, Parameter.PRO_CHARACTER 5, 0); 
parms.AddTable(0, table, ParamArrayMode.INPUT, metaData1); 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095